HBox_TabPane1

  • A Tab represents a single page and contained in a TabPane .
  • Tab can be any Node
  • A Tab consists of a title and content. The title consists of text, an optional graphic, and an optional close button to close the tab. The content consists
  • The tabs, placed with in TabPane,  can be selected at a time TabPane
Code:

package javafxtemplate1;
//Grid_Transform1.htm
import javafx.application.Application;
import javafx.beans.value.ObservableValue;
import javafx.event.Event;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;


/**
*
* @author Manas9
*/
public class JavaFXTemplate1 extends Application {
@Override
public void start(Stage primaryStage) {
Label label1 = new Label("Tabs Line ups");
HBox hbox = new HBox();
hbox.setPadding(new Insets(15, 12, 15, 12));
hbox.setSpacing(20);
hbox.setStyle("-fx-background-color:WHEAT;");
Tab tab1 = new Tab("Tab1");Tab tab2 = new Tab("Tab2");
tab1.setContent(new Rectangle(400,200, Color.LIGHTSTEELBLUE));
tab2.setContent(new Rectangle(400,200, Color.LIGHTSEAGREEN));
TabPane tabPane = new TabPane();
tabPane.getTabs().addAll(tab1,tab2);
hbox.getChildren().addAll(label1,tabPane);
Scene scene = new Scene(hbox, 550,300);
primaryStage.setScene(scene);
primaryStage.setTitle("Progressbar Indicator");
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
}



}
 

Runtime displays: